package ru.cod.rs.screens;

import java.util.List;

import ru.cod.rs.interfaces.Game;
import ru.cod.rs.interfaces.Graphics;
import ru.cod.rs.interfaces.Input.TouchEvent;
import ru.cod.rs.objects.Screen;
import android.graphics.Color;
import android.util.Log;

public class MenuScreen extends Screen {

	public MenuScreen(Game g) {

		super(g);
	}

	@Override
	public void update(float delta) {
		Graphics g = game.getGraphics();
		List<TouchEvent> events = game.getInput().getTouchEvents();
		Log.w("EVENTS SIZE:", "" + events.size());
		for (TouchEvent event : events) {
			if (event.type == TouchEvent.TOUCH_UP) {
				if (inBounds(event, g.getWidth() / 2, g.getHeight() / 2, 30, 15)) {
					game.setScreen(new GameScreen(game));
				}
			}
		}
	}

	@Override
	public void render(float delta) {

		Graphics g = game.getGraphics();
		// g.drawBitmap(Assets.allyHouse, 0,
		// g.getHeight() - Assets.allyHouse.getHeight() - 1);
		// g.drawBitmap(Assets.enemyHouse,
		// g.getWidth() - Assets.enemyHouse.getWidth() - 1, g.getHeight()
		// - Assets.enemyHouse.getHeight() - 1);
		// g.drawBitmap(Assets.unit, 0, g.getHeight() - Assets.unit.getHeight()
		// - 1);

		g.drawText("MENU", g.getWidth() / 2, g.getHeight() / 2 - 10,
				Color.YELLOW);
		g.drawText("Play", g.getWidth() / 2 + 5, g.getHeight() / 2 + 10,
				Color.RED);
	}

}
